﻿<views:PageBase x:Class="GoG.Client.Views.Pages.MyGamesPage"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:board="using:GoG.Board"
                xmlns:controls="using:GoG.Client.Controls"
                xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                xmlns:games="using:GoG.Client.ViewModels.Games"
                xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                xmlns:models="using:GoG.Client.Models"
                xmlns:pages="using:GoG.Client.ViewModels.Pages"
                xmlns:toolkit="using:WinRTXamlToolkit.Controls"
                xmlns:views="using:GoG.Client.Views"
                d:DataContext="{d:DesignInstance pages:MyGamesPageViewModel,
                                                 d:IsDesignTimeCreatable=False}"
                mc:Ignorable="d">

    <controls:MasterPage>
        <controls:MasterPage.Body>
            <toolkit:WrapPanel Orientation="Horizontal">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Style="{StaticResource GroupHeaderTextStyle}" Text="YOUR GAMES" />
                        <TextBlock Style="{StaticResource GroupHeaderTextStyle}" Text=" (" />
                        <TextBlock Style="{StaticResource GroupHeaderTextStyle}" Text="{Binding GamesIncrementalLoader.TotalCount}" />
                        <TextBlock Style="{StaticResource GroupHeaderTextStyle}" Text=")" />
                    </StackPanel>

                    <ListView Grid.Row="1"
                              Grid.Column="0"
                              Margin="0,10,0,0"
                              DataFetchSize="1"
                              ItemsSource="{Binding GamesIncrementalLoader}"
                              SelectionMode="None">
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Text="{Binding Name}" />
                                    <controls:GameBoard Grid.Row="1"
                                                        Grid.Column="0"
                                                        Width="400"
                                                        Height="400"
                                                        BoardEdgeSize="{Binding GameModel.width}"
                                                        IsHitTestVisible="False"
                                                        Pieces="{Binding Pieces}"
                                                        d:DataContext="{d:DesignInstance games:GameViewModel,
                                                                                         d:IsDesignTimeCreatable=False}" />
                                </Grid>
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Grid>
            </toolkit:WrapPanel>
        </controls:MasterPage.Body>
    </controls:MasterPage>
</views:PageBase>
